Skip to content

Conversation

@nirvn
Copy link
Member

@nirvn nirvn commented Sep 14, 2025

This unlocks translated projects on QFieldCloud by insuring that {project name}_{2-letter language code}.qm files are copied into the packaged project directory.

The PR also insures that sidecar translations and project plugin files properly adopt the exported project name (i.e. myproject.qgs -> myproject_cloud.qgs means the project plugin file will become myproject_cloud.qml and translation files would be myproject_de.qm, myproject_fr.qm, etc.).

Test coverage included.

Copy link
Collaborator

@suricactus suricactus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice functionality, +1 for the tests.

Code looks good. A few tiny comments on readability. Feel free to merge.

Do you consider this "QFieldCloud sensitive files", such as the plugins? Shall we add them here:
https://github.com/opengisch/QFieldCloud/blob/master/docker-app/qfieldcloud/filestorage/utils.py#L69

@nirvn
Copy link
Member Author

nirvn commented Sep 17, 2025

@suricactus , review addressed thanks.

Regarding "sensitive files", I wouldn't flag the translations as being sensitive. If you have a strong feeling about it, we can add it into the above-mentioned function.


# Check for project translations asset
for translation_file in glob(
f"{str(self.original_filename)[:-4]}_[A-Za-z][A-Za-z].qm"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we use the same pattern, so here also make [A-Za-z]{2}?

).resolve()
destination_file.parent.mkdir(parents=True, exist_ok=True)

# Project plugins and translation files require for their file name
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you see this portion of the code somehow moved to a function? I think it is a good isolated block that can be moved, the _convert function is already convoluted enough to be read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants